package TestDemo;

import java.util.*;
public class Main {
    public static void main(String[] args) {
        PriorityQueue<Integer> heap = new PriorityQueue<>((a, b) -> {
            return b - a;
        });
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long sz = n * 3;
        for (int i = 0; i < sz; i++) {
            int t = sc.nextInt();
            heap.add(t);
        }
        for (int i = 0; i < sz; i++) {
            System.out.println(heap.poll());
        }
    }
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String d = sc.nextLine();
        HashMap<Character, Integer> hashMap = new HashMap<>();
        for (int i = 0; i < d.length(); i++) {
            char ch = d.charAt(i);
            if (hashMap.get(ch) == null) {
                hashMap.put(ch, 1);
            } else {
                int val = hashMap.get(ch);
                hashMap.put(ch, val + 1);
            }
        }
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if (hashMap.get(ch) == null) {
                System.out.print(ch);
            }
        }
    }
}